package com.huanuo.internetofthings.service.jasperSimStatistics.statisitics;

import java.util.List;

import org.springframework.stereotype.Service;
import org.unicorn.framework.core.ResponseDto;
import org.unicorn.framework.core.SysCode;
import org.unicorn.framework.core.exception.PendingException;

import com.huanuo.internetofthings.bo.jasperSimStatistics.JasperSimStatistics;
import com.huanuo.internetofthings.bo.user.UserInfo;
import com.huanuo.internetofthings.dto.statistics.JasperStatisticsReqDto;
import com.huanuo.internetofthings.enums.JasperSimStatisticsType;
/**
 * 统计用户所在组  设备sim卡的使用情況
 * @author xiebin
 *
 */
@Service
public class JasperSimGroupNoStatisticsService extends AbstractJasperSimStatisticsService {

	@Override
	public JasperSimStatistics getJasperSimStatistics(UserInfo userInfo) throws PendingException {
		JasperSimStatistics jasperSimStatistics = new JasperSimStatistics();
		jasperSimStatistics.setGroupNo(userInfo.getGroupNo());
		int year = getYear();
		jasperSimStatistics.setYear(year);
		jasperSimStatistics.setMonth(getMonth());
		return jasperSimStatistics;
	}

	@Override
	public ResponseDto<?> calculationStatistics(List<JasperSimStatistics> statisticsList,UserInfo userInfo)
			throws PendingException {
		if(statisticsList.size()==0){
			new ResponseDto<>();
		}
		return new ResponseDto<>(statisticsList.get(0));
	}




	@Override
	public boolean supports(JasperStatisticsReqDto s) throws PendingException {
		return JasperSimStatisticsType.JasperSimGroupNo.equals(s.getJasperSimStatisticsType());
		
	}

}